require.config({
               baseUrl:"../",
               paths:{
               bsl:'bsl',
               
               }
               });
require(['bsl'],function(bsl){
        document.addEventListener('deviceready', onDeviceready, false);
        function onDeviceready(){
        alert("star");
        
        function addEventListener() {
        bsl.push.addEventListener('click',onSuccess1, false);
        }
        
        function onSuccess1(push) {
        document.getElementById('push').innerHTML= push
        }
        
        function onError1(push) {
        alert('Push Error: ' + push);
        }
        


        function createMessage() {
        
        //../plugins/bsl.cordova.plugins.push/www
        var content = "推送消息内容:欢迎使用变色龙推送工具";
        //业务逻辑的处理
        var payload = 1;

        var options = {title:'推送消息工具',sound:'UILocalNotificationDefaultSoundName',cover:false,when:'when',delay:10};
        
        bsl.push.createMessage(content, payload,options);
        }
        
        }
        
        function clear() {
        
        bsl.push.clear(onSuccess,onError);
        
        }
        
        function onSuccess(push) {
        //        var element = document.getElementById('push');
        //        element.innerHTML = 'Push: ' + push;
        
        document.getElementById('push').innerHTML= push;
        }
        
        function onError(push) {
        alert('Push error: ' + push);
        }

        
        function getClientInfo(){
        bsl.push.getClientInfo(onSuccess2);
        }
        
        function onSuccess2(ClientInfo){
        document.getElementById('push').innerHTML= 'token' + ClientInfo.token + '<br />' +  'clientid' + ClientInfo.clientid + '<br />' + 'appid' + clientid.appid + '<br />' + 'appkey' + appkey;
        }
        
        
        document.getElementById("addEventListener").addEventListener("click",addEventListener,false);
        document.getElementById("createMessage").addEventListener("click",createMessage,false);
        document.getElementById("clear").addEventListener("click",clear,false);
        document.getElementById("getClientInfo").addEventListener("click",getClientInfo,false);
        }
        
        });